﻿using System;
using System.Runtime.Serialization;

namespace Common
{
    public enum ReviewDecision
    {
        NotTakenYet = 0,
        SendArticleForRevision = 1,
        DeclineArticle = 2,
        MoveArticleToPortfolio = 3
    }

    public enum ReviewStatus
    {
        Created,
        Approved,
        Declined
    }

    [DataContract]
    public class Review : HsePSObject
    {
        public Review()
        { 
            ID = Guid.NewGuid().ToString();
            CreationTime = DateTime.Now;
            ModificationTime = DateTime.Now;
        }

        [DataMember]
        public string ID { get; private set; }
        [DataMember]
        public DateTime ModificationTime { get; private set; }
        [DataMember]
        public DateTime CreationTime { get; private set; }
        [DataMember]
        public string ArticleID { get; set; }
        [DataMember]
        public string AuthorID { get; set; }
        [DataMember]
        public string EditorComment { get; set; }
        [DataMember]
        public string AttachmentID { get; set; }
        [DataMember]
        public ReviewStatus Status
        {
            get { return (ReviewStatus)stage; }
            set 
            {
                this.ModificationTime = DateTime.Now;
                stage = (int)value; 
            }
        }
        public int stage { get; private set; }
        [DataMember]
        public ReviewDecision Decision
        {
            get { return (ReviewDecision)decisionNumber; }
            set { decisionNumber = (int)value; }
        }
        public int decisionNumber { get; private set; }
    }
}